<?php
/**
 * Created by PhpStorm.
 * User: Egg
 * Date: 2018/3/14
 * Time: 8:39
 */

namespace Admin\Controller;


use Think\Controller;

class LoginController extends Controller
{
    public function index()
    {
        //do before show login page
        $this->display('login');
    }

    public function login()
    {
        $userName = I('username');
        $password = I('password');
        $isRemember = I('is_remeber');
        //do search user in db
        if ($isRemember == 'on') {
            session('username', $userName);
            session('password', $password);
            session('isRemember', '1');
        } else {
            session('isRemember', '0');
        }

        $this->assign('username', $userName);
        $this->assign('password', $password);
        $this->assign('isRemember', $isRemember);
        $this->display('./index');
    }

}